package com.net;

import java.util.Comparator;

public class Employee implements Comparable<Employee>,Comparator<Employee>
{

	private String name;
	private String address;
	private int salary;
	
	public Employee()
	{
		
	}
	
	
	public int getSalary() {
		return salary;
	}


	public void setSalary(int salary) {
		this.salary = salary;
	}


	Employee(String name,String address, int salary)
	{
		this.name = name;
		this.address = address;
		this.salary = salary;
	}
	
	
	public String getName() {
		return name;
	}




	public void setName(String name) {
		this.name = name;
	}




	public String getAddress() {
		return address;
	}




	public void setAddress(String address) {
		this.address = address;
	}




	@Override
	public int compareTo(Employee emp) 
	{
		
		return (int) (this.salary - emp.getSalary());
	}


	@Override
	public int compare(Employee emp1, Employee emp2) {
		
		String s1 = emp1.getName();
		String s2 = emp2.getName();
		
		if(s1.compareTo(s2)>0)
			return 1;
		if(s1.compareTo(s2)<0)
			return -1;
		
		    else
		    return 0;
	}

	
}
